unit upasserversocashdrawer00;
{$I \source.75\common\LogOption.txt}

interface
uses
  SysUtils,
  upasserversocashdrawer,
  upascashdrawerso00;

type
  EOupasserversocashdrawer00 = class(EOupasserversocashdrawer)
  private
    // The UPAS SO Interface
    FUPASSO: EOupascashdrawerso00;

    FOPOSLDN: String;
    FOpenStatus: Integer;
    FClaimStatus: Integer;

  protected
    procedure OnCharEvent(Value: String); override;
    procedure OnStringEvent(Value: String); override;
    procedure OnXMLEvent(Value: String); override;

    // Common Properties getter/setter
    function getAutoDisable: Boolean; override;
    function getBinaryConversion: Integer; override;
    function getCapCompareFirmwareVersion: Boolean; override;
    function getCapPowerReporting: Integer; override;
    function getCapStatisticsReporting: Boolean; override;
    function getCapUpdateFirmware: Boolean; override;
    function getCapUpdateStatistics: Boolean; override;
    function getCheckHealthText: String; override;
    function getClaimed: Boolean; override;
    function getControlObjectDescription: String; override;
    function getControlObjectVersion: Integer; override;
    function getDataCount: Boolean; override;
    function getDataEventEnabled: Boolean; override;
    function getDeviceControlDescription: String; override;
    function getDeviceControlVersion: Integer; override;
    function getDeviceDescription: String; override;
    function getDeviceEnabled: Boolean; override;
    function getDeviceName: String; override;
    function getDeviceServiceDescription: String; override;
    function getDeviceServiceVersion: Integer; override;
    function getFreezeEvents: Boolean; override;
    function getOpenResult: Integer; override;
    function getOutpuID: Integer; override;
    function getPhysicalDeviceDescription: String; override;
    function getPhysicalDeviceName: String; override;
    function getPowerNotify: Integer; override;
    function getPowerState: Integer; override;
    function getResultCode: Integer; override;
    function getResultCodeExtended: Integer; override;
    function getServiceObjectDescription: String; override;
    function getServiceObjectVersion: Integer; override;
    function getState: Integer; override;
    procedure setAutoDisable(Value: Boolean); override;
    procedure setBinaryConversion(Value: Integer); override;
    procedure setDataEventEnabled(Value: Boolean); override;
    procedure setDeviceEnabled(Value: Boolean); override;
    procedure setFreezeEvents(Value: Boolean); override;
    procedure setPowerNotify(Value: Integer); override;

    // CashDrawer Properties getter/setter
    function getCapStatus: WordBool; override;
    function getCapStatusMultiDrawerDetect: WordBool; override;
    function getDrawerOpened: WordBool; override;

  public
    // Common Methods
    function CheckHealth(Level: Integer): Integer; override;
    function ClaimDevice(Timeout: Integer): Integer; override;
    function ClearInput: Integer; override;
    function ClearInputProperties: Integer; override;
    function ClearOutput: Integer; override;
    function Close: Integer; override;
    function CompareFirmwareVersion(const FirmwareFileName: WideString; out pResult: Integer): Integer; override;
    function DirectIO(Command: Integer; var pData: Integer; var pString: WideString): Integer; override;
    function Open(const DeviceName: String): Integer; override;
    function ReleaseDevice: Integer; override;
    function ResetStatistics(const StatisticsBuffer: WideString): Integer; override;
    function RetrieveStatistics(var pStatisticsBuffer: WideString): Integer; override;
    function UpdateFirmware(const FirmwareFileName: WideString): Integer; override;
    function UpdateStatistics(const StatisticsBuffer: WideString): Integer; override;

    // CashDrawer Methods
    function OpenDrawer: Integer; override;
    function WaitForDrawerClose(BeepTimeout: Integer; BeepFrequency: Integer; BeepDuration: Integer; BeepDelay: Integer): Integer;  override;

    constructor Create(DeviceName: String; ParentDeviceName: String = '');
    destructor Destroy; override;

  end;

implementation
uses
  AuditLog,
  opos;

procedure EOupasserversocashdrawer00.OnCharEvent(Value: String); begin end;
procedure EOupasserversocashdrawer00.OnStringEvent(Value: String); begin end;
procedure EOupasserversocashdrawer00.OnXMLEvent(Value: String); begin end;
function EOupasserversocashdrawer00.getAutoDisable: Boolean; begin end;
function EOupasserversocashdrawer00.getBinaryConversion: Integer; begin end;
function EOupasserversocashdrawer00.getCapCompareFirmwareVersion: Boolean; begin end;
function EOupasserversocashdrawer00.getCapPowerReporting: Integer; begin end;
function EOupasserversocashdrawer00.getCapStatisticsReporting: Boolean; begin end;
function EOupasserversocashdrawer00.getCapUpdateFirmware: Boolean; begin end;
function EOupasserversocashdrawer00.getCapUpdateStatistics: Boolean; begin end;
function EOupasserversocashdrawer00.getCheckHealthText: String; begin end;
function EOupasserversocashdrawer00.getClaimed: Boolean; begin end;
function EOupasserversocashdrawer00.getControlObjectDescription: String; begin end;
function EOupasserversocashdrawer00.getControlObjectVersion: Integer; begin end;
function EOupasserversocashdrawer00.getDataCount: Boolean; begin end;
function EOupasserversocashdrawer00.getDataEventEnabled: Boolean; begin end;
function EOupasserversocashdrawer00.getDeviceControlDescription: String; begin end;
function EOupasserversocashdrawer00.getDeviceControlVersion: Integer; begin end;
function EOupasserversocashdrawer00.getDeviceDescription: String; begin end;
function EOupasserversocashdrawer00.getDeviceEnabled: Boolean; begin end;
function EOupasserversocashdrawer00.getDeviceName: String; begin end;
function EOupasserversocashdrawer00.getDeviceServiceDescription: String; begin end;
function EOupasserversocashdrawer00.getDeviceServiceVersion: Integer; begin end;
function EOupasserversocashdrawer00.getFreezeEvents: Boolean; begin end;
function EOupasserversocashdrawer00.getOpenResult: Integer; begin end;
function EOupasserversocashdrawer00.getOutpuID: Integer; begin end;
function EOupasserversocashdrawer00.getPhysicalDeviceDescription: String; begin end;
function EOupasserversocashdrawer00.getPhysicalDeviceName: String; begin end;
function EOupasserversocashdrawer00.getPowerNotify: Integer; begin end;
function EOupasserversocashdrawer00.getPowerState: Integer; begin end;
function EOupasserversocashdrawer00.getResultCode: Integer; begin end;
function EOupasserversocashdrawer00.getResultCodeExtended: Integer; begin end;
function EOupasserversocashdrawer00.getServiceObjectDescription: String; begin end;
function EOupasserversocashdrawer00.getServiceObjectVersion: Integer; begin end;
function EOupasserversocashdrawer00.getState: Integer; begin end;
procedure EOupasserversocashdrawer00.setAutoDisable(Value: Boolean); begin end;
procedure EOupasserversocashdrawer00.setBinaryConversion(Value: Integer); begin end;
procedure EOupasserversocashdrawer00.setDataEventEnabled(Value: Boolean); begin end;
procedure EOupasserversocashdrawer00.setDeviceEnabled(Value: Boolean); begin end;
procedure EOupasserversocashdrawer00.setFreezeEvents(Value: Boolean); begin end;
procedure EOupasserversocashdrawer00.setPowerNotify(Value: Integer); begin end;
function EOupasserversocashdrawer00.getCapStatus: WordBool; begin end;
function EOupasserversocashdrawer00.getCapStatusMultiDrawerDetect: WordBool; begin end;
function EOupasserversocashdrawer00.getDrawerOpened: WordBool; begin end;
function EOupasserversocashdrawer00.CheckHealth(Level: Integer): Integer; begin end;
function EOupasserversocashdrawer00.ClaimDevice(Timeout: Integer): Integer; begin end;
function EOupasserversocashdrawer00.ClearInput: Integer; begin end;
function EOupasserversocashdrawer00.ClearInputProperties: Integer; begin end;
function EOupasserversocashdrawer00.ClearOutput: Integer; begin end;
function EOupasserversocashdrawer00.Close: Integer; begin end;
function EOupasserversocashdrawer00.CompareFirmwareVersion(const FirmwareFileName: WideString; out pResult: Integer): Integer; begin end;
function EOupasserversocashdrawer00.DirectIO(Command: Integer; var pData: Integer; var pString: WideString): Integer; begin end;
function EOupasserversocashdrawer00.Open(const DeviceName: String): Integer; begin end;
function EOupasserversocashdrawer00.ReleaseDevice: Integer; begin end;
function EOupasserversocashdrawer00.ResetStatistics(const StatisticsBuffer: WideString): Integer; begin end;
function EOupasserversocashdrawer00.RetrieveStatistics(var pStatisticsBuffer: WideString): Integer; begin end;
function EOupasserversocashdrawer00.UpdateFirmware(const FirmwareFileName: WideString): Integer; begin end;
function EOupasserversocashdrawer00.UpdateStatistics(const StatisticsBuffer: WideString): Integer; begin end;
function EOupasserversocashdrawer00.OpenDrawer: Integer; begin end;
function EOupasserversocashdrawer00.WaitForDrawerClose(BeepTimeout: Integer; BeepFrequency: Integer; BeepDuration: Integer; BeepDelay: Integer): Integer;  begin end;

constructor EOupasserversocashdrawer00.Create(DeviceName: String; ParentDeviceName: String = '');
begin
  {$IFDEF LOGUNITTEST}
  AuditLog.EventLog(AuditLog.etDUNIT, EOupasserversocashdrawer00.ClassName + '.Create', 'DeviceName="' + DeviceName + '"');
  {$ENDIF}

  Inherited Create(DeviceName);

  try
    FUPASSO := EOupascashdrawerso00.Create;
  except
    on E: Exception do begin
      AuditLog.EventLog(AuditLog.etException, EOupasserversocashdrawer00.ClassName, EOupascashdrawerso00.ClassName + ' ' + E.Message);
    end;
  end;

  FUPASSO.OnDirectIOEvent := OnDirectIOEvent;
  FUPASSO.OnStatusUpdateEvent := OnStatusUpdateEvent;

  FOpenStatus := FUPASSO.Open(FOPOSLDN);
  {$IFDEF LOGUNITTEST}
  AuditLog.EventLog(AuditLog.etDUNIT, EOupasserversocashdrawer00.ClassName + '.Create', 'FOpenStatus="' + IntToStr(FOpenStatus) + '"');
  {$ENDIF}

  FClaimStatus := opos.OPOS_E_CLAIMED;
  {$IFDEF LOGUNITTEST}
  AuditLog.EventLog(AuditLog.etDUNIT, EOupasserversocashdrawer00.ClassName + '.Create', 'FClaimStatus="' + IntToStr(FClaimStatus) + '"');
  {$ENDIF}
end;

destructor EOupasserversocashdrawer00.Destroy;
begin
  {$IFDEF LOGUNITTEST}
  AuditLog.EventLog(AuditLog.etDUNIT, EOupasserversocashdrawer00.ClassName + '.Destroy', '');
  {$ENDIF}

  Inherited;
end;

end.
